package org.shiwen.week12.answer;

public class Q2 {
    public static void main(String[] args) {
        long sum = 0;//请注意，要用long int会溢出，导致答案错误
        long add = 1;
        for (long i = 1; i <= 20; i++){//确定循环次数
            sum += add*i;//统计阶乘
            add = add*i;//保存上一次阶乘的结果
        }
        System.out.println( sum);
    }
}
